<?php
namespace app\common\model;

use think\Model;

class UsedClassify extends Model
{
	protected $insert = ['create_time'];

	protected function setCreateTimeAttr()
	{
		return date('Y-m-d H:i:s');
	}

	/**
     * 序列化
     * @param $value
     * @return string
     */
    protected function setPidAttr($value)
    {
    	if(is_array($value))
        	return implode(',', $value);
    	else
    		return $value;
    	
    }

    /**
     * 反序列化
     * @param $value
     * @return mixed
     */
    protected function getPidAttr($value)
    {
    	$arr = ['0','1','2','3','4'];
    	if(in_array($value, $arr))
    		return $value;
    	else
    		return explode(',', $value); 
    }
}